
//跑的快房卡模式
module.exports.createRoom = function(roomId,channelService,GameRemote) {
	var basic = require("./hunanRunQuickly.js").createRoom
	var room = new basic(roomId,channelService,GameRemote)
	//添加解散模块
	var dissolution = require("./basic/dissolution.js")
	dissolution.call(room)
	room.roomMode = "hunanRunQuicklyRoom"
	console.log("hunanRunQuicklyRoom!!!!")
	//设置游戏信息
	room.setBeforeInfo = function(info) {
		if(info.gameNumber && typeof(info.gameNumber) == "number" && info.gameNumber > 0){
			room.maxGameNumber = info.gameNumber
		}
		if(info.mustPlay === false){
			room.mustPlay = false
		}
		if(info.graded === true){
			room.graded = true
		}
		if(typeof(info.keyType) === "number" && info.keyType >= 0 && info.keyType <= 3){
			var card = {num : 3,type : Math.floor(info.keyType)}
			room.setKeyCard(card)
		}
		if(info.customData && typeof(info.customData) == "string"){
			room.customData = info.customData
		}
		room.minCardValue = 190
	}
	//游戏结束保存战绩
	room.gameOverBefore = function() {
		if(room.gameNumber > 0){
			var roomData = room.getRoomData()
			var notify = {
				cmd : "largeSettlement",
				roomData : roomData
			}
			room.sendAll(notify)
			GameRemote.app.rpc.db.hunanRunQuickly.saveRoomHistory(null,roomData,function(){})
		}
		clearTimeout(room.playTimer)
		room.gameOver()
	}
	room.joinLaterFun = function(chair) {
		if(room.players[chair].playerInfo.contorl){
			room.luckys[chair] = parseInt(room.players[chair].playerInfo.contorl)
		}
	}
	return room
}